<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SeaweedFS Docker 入门教程</title>
    <meta name="description" content="SeaweedFS 是一个简单且高度可扩展的分布式文件系统。 有两个目标：存储数十亿个文件！ 快速提供文件！ SeaweedFS实现了一个带有O（1）磁盘搜索的对象存储，以及一个带有POSIX接口的可选Filer。">
    <meta name="keywords" content="docker,containers,tutorial">
    <link rel="stylesheet" type="text/css" href="../css/main.css?v=1.29.0">
    <link rel="stylesheet" type="text/css" href="../css/tocbot.css?v=1.29.0">
    <link rel="stylesheet" type="text/css" href="../css/media.css?v=1.29.0">
    <link rel="stylesheet" type="text/css" href="../css/sidebar.css?v=1.29.0">
    <link rel="stylesheet" type="text/css" href="../css/copy.css?v=1.29.0">
    <link rel="stylesheet" type="text/css" href="../css/demo-preview.css?v=1.29.0">
    <link rel="icon" href="../img/logo.svg" type="image/x-icon">
    <script src="../js/copy.js?v=1.29.0"></script>
    <script src="../js/dark-mode.js?v=1.29.0"></script>
    <script src="../js/markdown-style.js?v=1.29.0"></script>
  </head>
  <body id="idoctotop"><a href="#idoctotop" class="gototop">top</a>
    <header class="header">
      <article class="inner warpper"><a class="logo" href="../index.html"><svg viewBox="0 0 1280 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
            <path d="M699.88718 472.6h-132.2v-118.8h132.2v118.8z m0-408.6h-132.2v121.4h132.2V64z m156.4 289.6H724.08718v118.8h132.2v-118.8z m-312.6-144.2h-132.2v120.2h132.2v-120.2z m156.2 0h-132.2v120.2h132.2v-120.2z m553.6 200c-28.8-19.4-95.2-26.4-146.2-16.8-6.6-48-33.4-89.8-82.2-127.4l-28-18.6-18.6 28c-36.8 55.6-46.8 147.2-7.4 207.6-17.4 9.4-51.6 22.2-96.8 21.4H4.88718c-17.4 101.6 11.6 233.6 88 324.2 74.2 87.8 185.4 132.4 330.8 132.4 314.8 0 547.8-145 656.8-408.4 42.8 0.8 135.2 0.2 182.6-90.4 3-5 13.2-26.4 17-34.2l-26.6-17.8z m-1022.2-55.8h-132v118.8h132.2v-118.8z m156.2 0h-132.2v118.8h132.2v-118.8z m156.2 0h-132.2v118.8h132.2v-118.8z m-156.2-144.2h-132.2v120.2h132.2v-120.2z" fill="#0187D1"></path>
          </svg>
<span class="title">Docker 入门教程</span></a>
        <div class="content">
          <ul class="menu">
            <li><a href="../index.html" target="" class="">Home</a></li>
            <li><a href="https://wangchujiang.com/#/sponsor" target="__blank" class="">Sponsor</a></li>
          </ul><a href="https://github.com/jaywcjlove/docker-tutorial" target="_blank" rel="noopener noreferrer" title="Github" name="Github" class="github"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
              <path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path>
            </svg></a>
          <dark-mode permanent=""></dark-mode>
        </div>
      </article>
    </header>
    <div class="warpper-content warpper sidebar">
      <div class="sidebar-border">
        <aside class="sidebar" role="navigation">
          <div>
            <a href="../index.html" class="">入门</a>
            <label>实践</label>
            <a href="../docker-compose.html" class="">Docker Compose</a>
            <a href="../elasticsearch.html" class="">ElasticSearch 搜索服务器</a>
            <a href="../gitlab/index.html" class="">Gitlab 代码仓库管理系统</a>
            <a href="../harbor.html" class="">Harbor</a>
            <a href="../mattermost.html" class="">Mattermost 聊天工具</a>
            <a href="../mysql.html" class="">MySQL 数据库</a>
            <a href="../nginx.html" class="">Nginx Web 服务器</a>
            <a href="../nps/index.html" class="">NPS 内网穿透</a>
            <a href="../portainer.html" class="">Portainer Docker 管理</a>
            <a href="../postgres.html" class="">PostgreSQL 数据库</a>
            <a href="../penpot.html" class="">Penpot 设计和原型</a>
            <a href="../navidrome.html" class="">Navidrome 音乐服务器</a>
            <a href="../rancher.html" class="">Rancher 容器管理平台</a>
            <a href="../redis.html" class="">Redis 数据库</a>
            <a href="../rocket.chat/index.html" class="">Rocket.Chat 聊天工具</a>
            <a href="index.html" class="active">SeaweedFS 文件系统</a>
            <a href="../sourcegraph/index.html" class="">Sourcegraph 代码搜索引擎</a>
          </div>
        </aside>
      </div>
      <markdown-style theme-auto-switch-disabled="">
        <h1 id="seaweedfs"><a aria-hidden="true" tabindex="-1" href="#seaweedfs" class="anchor"><span class="icon icon-link"></span></a>SeaweedFS</h1>
        <p><a href="https://github.com/chrislusf/seaweedfs">SeaweedFS</a> 是一个简单且高度可扩展的分布式文件系统。 有两个目标：存储数十亿个文件！ 快速提供文件！ SeaweedFS实现了一个带有O（1）磁盘搜索的对象存储，以及一个带有POSIX接口的可选Filer。</p>
        <pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line line-number" line="1"><span class="token function">docker</span> build <span class="token parameter variable">-t</span> wcjiang/seaweedfs <span class="token builtin class-name">.</span> <span class="token comment"># 编译docker镜像</span>
</span><span class="code-line line-number" line="2"><span class="token function">docker</span> push wcjiang/seaweedfs:latest
</span><span class="code-line line-number" line="3"><span class="token function">docker-compose</span> up <span class="token comment"># 使用docker-compose 执行新建容器组</span>
</span><span class="code-line line-number" line="4"><span class="token function">docker-compose</span> start <span class="token comment"># 启动容器组</span>
</span><span class="code-line line-number" line="5"><span class="token function">docker-compose</span> stop <span class="token comment"># 停止容器组</span>
</span><span class="code-line line-number" line="6"><span class="token function">docker-compose</span> <span class="token function">ps</span>   <span class="token comment"># 查询容器组所有容器状态</span>
</span><span class="code-line line-number" line="7"><span class="token function">docker-compose</span> down <span class="token comment"># 删除容器组</span>
</span></code><input type="hidden" value="docker build -t wcjiang/seaweedfs . # 编译docker镜像
docker push wcjiang/seaweedfs:latest
docker-compose up # 使用docker-compose 执行新建容器组
docker-compose start # 启动容器组
docker-compose stop # 停止容器组
docker-compose ps   # 查询容器组所有容器状态
docker-compose down # 删除容器组
"><div onclick="copied(this)" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
        <p>⚠️： <code>volume</code> 节点不可以被负载均衡，不然会出现上传错误。</p>
        <h2 id="名词"><a aria-hidden="true" tabindex="-1" href="#名词" class="anchor"><span class="icon icon-link"></span></a>名词</h2>
        <ul>
          <li><code>master</code>: 主节点，即集群管理，同时存储文件和fid映射关系</li>
          <li><code>volume</code>: 1、文件卷节点，实际存储文件；2、卷，一个存储级别</li>
          <li><code>client</code>: 客户端，该FS使用RESTful交互，所以客户端都归纳为一类</li>
          <li><code>dataCenter</code>: 数据中心，简称DC</li>
          <li><code>rack</code>: 机架。一个机架属于特定的数据中心，一个数据中心可以包含多个机架。</li>
        </ul>
        <pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line line-number" line="1">                                    ┌┈┈┈┈┈┈┈┈┐  ┌┈┈┈┈┈┈┈┈┐
</span><span class="code-line line-number" line="2">                                    ┆        ┆  ┆        ┆
</span><span class="code-line line-number" line="3">┌┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┐              ┆M-master├┈┈┤S-master┆
</span><span class="code-line line-number" line="4">┆                    ├┈┈┈┈┈┈┈┈┈┈┈┈›▷▶        ┆  ┆        ┆
</span><span class="code-line line-number" line="5">┆ client/web browser ┆              └┈┈┈┬┈┈┈┈┘  └┈┈┈┬┈┈┈┈┘
</span><span class="code-line line-number" line="6">┆                    ├┈┈┐               ┆           ┆
</span><span class="code-line line-number" line="7">└┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┘  ┆         ┌┈┈┈┈┈┴┈┈┈┈┈┬┈┈┈┈┈┴┈┈┈┈┈┐
</span><span class="code-line line-number" line="8">                        ┆         ┆           ┆           ┆
</span><span class="code-line line-number" line="9">                        ┆         ┆           ┆           ┆
</span><span class="code-line line-number" line="10">                        ┆     ┌┈┈┈┴┈┈┈┈┐  ┌┈┈┈┴┈┈┈┈┐  ┌┈┈┈┴┈┈┈┈┐
</span><span class="code-line line-number" line="11">                        ┆     ┆        ┆  ┆        ┆  ┆        ┆
</span><span class="code-line line-number" line="12">                        └┈┈┈›▷▶ volume ┆  ┆ volume ┆  ┆ volume ┆
</span><span class="code-line line-number" line="13">                              ┆        ┆  ┆        ┆  ┆        ┆
</span><span class="code-line line-number" line="14">                              └┈┈┈┈┈┈┈┈┘  └┈┈┈┈┈┈┈┈┘  └┈┈┈┈┈┈┈┈┘
</span></code><input type="hidden" value="                                    ┌┈┈┈┈┈┈┈┈┐  ┌┈┈┈┈┈┈┈┈┐
                                    ┆        ┆  ┆        ┆
┌┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┐              ┆M-master├┈┈┤S-master┆
┆                    ├┈┈┈┈┈┈┈┈┈┈┈┈›▷▶        ┆  ┆        ┆
┆ client/web browser ┆              └┈┈┈┬┈┈┈┈┘  └┈┈┈┬┈┈┈┈┘
┆                    ├┈┈┐               ┆           ┆
└┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┘  ┆         ┌┈┈┈┈┈┴┈┈┈┈┈┬┈┈┈┈┈┴┈┈┈┈┈┐
                        ┆         ┆           ┆           ┆
                        ┆         ┆           ┆           ┆
                        ┆     ┌┈┈┈┴┈┈┈┈┐  ┌┈┈┈┴┈┈┈┈┐  ┌┈┈┈┴┈┈┈┈┐
                        ┆     ┆        ┆  ┆        ┆  ┆        ┆
                        └┈┈┈›▷▶ volume ┆  ┆ volume ┆  ┆ volume ┆
                              ┆        ┆  ┆        ┆  ┆        ┆
                              └┈┈┈┈┈┈┈┈┘  └┈┈┈┈┈┈┈┈┘  └┈┈┈┈┈┈┈┈┘
"><div onclick="copied(this)" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
        <h2 id="写文件"><a aria-hidden="true" tabindex="-1" href="#写文件" class="anchor"><span class="icon icon-link"></span></a>写文件</h2>
        <p><strong>上传文件</strong>：首先，将HTTP <code>POST</code>，<code>PUT</code>或<code>GET</code>请求发送到 <code>/dir/assign</code>以获取fid和卷服务器URL：</p>
        <pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line line-number" line="1"><span class="token function">curl</span> http://localhost:9333/dir/assign
</span><span class="code-line line-number" line="2"><span class="token comment"># {"count":1,"fid":"3,01637037d6","url":"127.0.0.1:8080","publicUrl":"localhost:8080"}</span>
</span></code><input type="hidden" value="curl http://localhost:9333/dir/assign
# {&#x22;count&#x22;:1,&#x22;fid&#x22;:&#x22;3,01637037d6&#x22;,&#x22;url&#x22;:&#x22;127.0.0.1:8080&#x22;,&#x22;publicUrl&#x22;:&#x22;localhost:8080&#x22;}
"><div onclick="copied(this)" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
        <p>其次，要存储文件内容，请从响应中向 <code>URL +'/'+ fid</code> 发送<code>HTTP</code> <code>POST</code>请求：</p>
        <pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line line-number" line="1"><span class="token function">curl</span> <span class="token parameter variable">-F</span> <span class="token assign-left variable">file</span><span class="token operator">=</span>@/home/chris/myphoto.jpg http://127.0.0.1:8080/3,01637037d6
</span><span class="code-line line-number" line="2"><span class="token comment"># {"size": 43234}</span>
</span></code><input type="hidden" value="curl -F file=@/home/chris/myphoto.jpg http://127.0.0.1:8080/3,01637037d6
# {&#x22;size&#x22;: 43234}
"><div onclick="copied(this)" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
        <p>⚠️：要更新，请发送包含更新文件内容的其他POST请求。</p>
        <h2 id="删除文件"><a aria-hidden="true" tabindex="-1" href="#删除文件" class="anchor"><span class="icon icon-link"></span></a>删除文件</h2>
        <p>将HTTP DELETE请求发送到相同的<code>URL +'/'+ fid</code> URL：</p>
        <pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line line-number" line="1"><span class="token function">curl</span> <span class="token parameter variable">-X</span> DELETE http://127.0.0.1:8083/3,01637037d6
</span></code><input type="hidden" value="curl -X DELETE http://127.0.0.1:8083/3,01637037d6
"><div onclick="copied(this)" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
        <h2 id="保存文件id"><a aria-hidden="true" tabindex="-1" href="#保存文件id" class="anchor"><span class="icon icon-link"></span></a>保存文件ID</h2>
        <p>现在，您可以将fid（本例中为3,01637037d6）保存到数据库字段中。</p>
        <p>开头的数字 <code>3</code> 表示卷 <code>ID</code>。 在逗号之后，它是一个文件密钥 <code>01</code> 和一个文件 cookie <code>637037d6</code></p>
        <p>卷<code>id</code>是无符号的32位整数。 文件密钥是无符号的64位整数。 文件cookie是无符号的32位整数，用于防止URL猜测。</p>
        <p>文件密钥和文件cookie都以十六进制编码。 您可以以自己的格式存储<code>&#x3C;volume id，file key，file cookie></code>元组，或者只是将fid存储为字符串。</p>
        <p>如果存储为字符串，理论上，您需要<code>8+1+16+8=33</code>字节。 如果不是绰绰有余，char(33) 就足够了，因为大多数用法不需要 <code>2^32</code>卷。</p>
        <p>如果空间确实存在问题，您可以使用自己的格式存储文件ID。 对于卷id，您需要一个4字节整数，对于文件密钥，需要8字节长整数，对于文件cookie，需要4字节整数。 所以16个字节绰绰有余。</p>
        <h2 id="读取文件"><a aria-hidden="true" tabindex="-1" href="#读取文件" class="anchor"><span class="icon icon-link"></span></a>读取文件</h2>
        <p>以下是如何呈现URL的示例。</p>
        <p>首先按文件的 <code>volumeId</code> 查找卷服务器的URL：</p>
        <pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line line-number" line="1"><span class="token function">curl</span> http://localhost:9333/dir/lookup?volumeId<span class="token operator">=</span><span class="token number">3</span>
</span><span class="code-line line-number" line="2"><span class="token comment"># {"locations":[{"publicUrl":"localhost:8080","url":"localhost:8080"}]}</span>
</span></code><input type="hidden" value="curl http://localhost:9333/dir/lookup?volumeId=3
# {&#x22;locations&#x22;:[{&#x22;publicUrl&#x22;:&#x22;localhost:8080&#x22;,&#x22;url&#x22;:&#x22;localhost:8080&#x22;}]}
"><div onclick="copied(this)" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
        <p>由于（通常）卷服务器不是太多，并且卷不经常移动，因此您可以在大多数时间缓存结果。 根据复制类型，一个卷可以具有多个副本位置。 只需随机选择一个位置即可阅读。</p>
        <p>现在您可以通过url获取公共URL，呈现URL或直接从卷服务器读取：</p>
        <pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line line-number" line="1">http://localhost:8083/3,01637037d6.jpg
</span></code><input type="hidden" value="http://localhost:8083/3,01637037d6.jpg
"><div onclick="copied(this)" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
        <p>⚠️：请注意，我们在这里添加文件扩展名 <code>.jpg</code>。 它是可选的，只是客户端指定文件内容类型的一种方式。</p>
        <p>如果您想要更好的URL，可以使用以下其中一种替代URL格式：</p>
        <pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line line-number" line="1">http://localhost:8083/3/01637037d6/my_preferred_name.jpg
</span><span class="code-line line-number" line="2">http://localhost:8083/3/01637037d6.jpg
</span><span class="code-line line-number" line="3">http://localhost:8083/3,01637037d6.jpg
</span><span class="code-line line-number" line="4">http://localhost:8083/3/01637037d6
</span><span class="code-line line-number" line="5">http://localhost:8083/3,01637037d6
</span></code><input type="hidden" value="http://localhost:8083/3/01637037d6/my_preferred_name.jpg
http://localhost:8083/3/01637037d6.jpg
http://localhost:8083/3,01637037d6.jpg
http://localhost:8083/3/01637037d6
http://localhost:8083/3,01637037d6
"><div onclick="copied(this)" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
        <p>如果您想获得图像的缩放版本，可以添加一些参数：</p>
        <pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line line-number" line="1">http://localhost:8083/3/01637037d6.jpg?height<span class="token operator">=</span><span class="token number">200</span><span class="token operator">&#x26;</span><span class="token assign-left variable">width</span><span class="token operator">=</span><span class="token number">200</span>
</span><span class="code-line line-number" line="2">http://localhost:8083/3/01637037d6.jpg?height<span class="token operator">=</span><span class="token number">200</span><span class="token operator">&#x26;</span><span class="token assign-left variable">width</span><span class="token operator">=</span><span class="token number">200</span><span class="token operator">&#x26;</span><span class="token assign-left variable">mode</span><span class="token operator">=</span>fit
</span><span class="code-line line-number" line="3">http://localhost:8083/3/01637037d6.jpg?height<span class="token operator">=</span><span class="token number">200</span><span class="token operator">&#x26;</span><span class="token assign-left variable">width</span><span class="token operator">=</span><span class="token number">200</span><span class="token operator">&#x26;</span><span class="token assign-left variable">mode</span><span class="token operator">=</span>fill
</span></code><input type="hidden" value="http://localhost:8083/3/01637037d6.jpg?height=200&#x26;width=200
http://localhost:8083/3/01637037d6.jpg?height=200&#x26;width=200&#x26;mode=fit
http://localhost:8083/3/01637037d6.jpg?height=200&#x26;width=200&#x26;mode=fill
"><div onclick="copied(this)" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
        <div class="previous"><a class="prev" href="../rocket.chat/index.html"><svg viewBox="0 0 1024 1024" width="16" height="16" fill="currentColor">
              <path d="M842.666667 864c-8.533333 0-14.933333-2.133333-21.333334-8.533333l-341.333333-309.333334c-6.4-6.4-10.666667-14.933333-10.666667-23.466666 0-8.533333 4.266667-17.066667 10.666667-23.466667l341.333333-309.333333c12.8-12.8 34.133333-10.666667 44.8 2.133333 12.8 12.8 10.666667 34.133333-2.133333 44.8L548.266667 522.666667l315.733333 285.866666c12.8 10.666667 14.933333 32 2.133333 44.8-6.4 6.4-14.933333 10.666667-23.466666 10.666667z"></path>
              <path d="M512 864c-8.533333 0-14.933333-2.133333-21.333333-8.533333L149.333333 546.133333c-6.4-6.4-10.666667-14.933333-10.666666-23.466666 0-8.533333 4.266667-17.066667 10.666666-23.466667L490.666667 189.866667c12.8-12.8 34.133333-10.666667 44.8 2.133333 12.8 12.8 10.666667 34.133333-2.133334 44.8L217.6 522.666667 533.333333 808.533333c12.8 12.8 14.933333 32 2.133334 44.8-6.4 6.4-14.933333 10.666667-23.466667 10.666667z"></path>
            </svg>
<span>Rocket.Chat 聊天工具
</span></a><a class="next" href="../sourcegraph/index.html"><span>Sourcegraph 代码搜索引擎
</span><svg viewBox="0 0 1024 1024" width="16" height="16" fill="currentColor">
              <path d="M544 522.666667c0-8.533333-4.266667-17.066667-10.666667-23.466667L192 189.866667c-12.8-12.8-34.133333-10.666667-44.8 2.133333-12.8 12.8-10.666667 34.133333 2.133333 44.8l315.733334 285.866667L149.333333 808.533333c-12.8 12.8-14.933333 32-2.133333 44.8 6.4 6.4 14.933333 10.666667 23.466667 10.666667 8.533333 0 14.933333-2.133333 21.333333-8.533333l341.333333-309.333334c6.4-6.4 10.666667-14.933333 10.666667-23.466666z"></path>
              <path d="M864 499.2l-341.333333-309.333333c-12.8-12.8-34.133333-10.666667-44.8 2.133333-12.8 12.8-10.666667 34.133333 2.133333 44.8l315.733333 285.866667-315.733333 285.866666c-12.8 12.8-14.933333 32-2.133333 44.8 6.4 6.4 14.933333 10.666667 23.466666 10.666667 8.533333 0 14.933333-2.133333 21.333334-8.533333l341.333333-309.333334c6.4-6.4 10.666667-14.933333 10.666667-23.466666 0-8.533333-4.266667-17.066667-10.666667-23.466667z"></path>
            </svg></a></div>
        <section class="article-footer"><a href="https://github.com/jaywcjlove/docker-tutorial/tree/master/docs/seaweedfs/README.md" class="edit-button" target="_blank" rel="noopener noreferrer"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path>
            </svg>
<span>Edit this page on GitHub</span>
</a><span class="atime">2022/06/27</span></section>
      </markdown-style>
      <nav class="tocs">
        <aside class="inner toc">
          <ol class="tocs-list">
            <li><a href="#名词" class="tocs-link">名词</a></li>
            <li><a href="#写文件" class="tocs-link">写文件</a></li>
            <li><a href="#删除文件" class="tocs-link">删除文件</a></li>
            <li><a href="#保存文件id" class="tocs-link">保存文件ID</a></li>
            <li><a href="#读取文件" class="tocs-link">读取文件</a></li>
          </ol>
        </aside>
      </nav>
    </div>
    <script src="../js/demo-preview.js?v=1.29.0"></script>
    <div class="footer warpper">
      <a href="https://wangchujiang.com/#/app" target="_blank">App</a> •
      <a href="https://wangchujiang.com/#/projects" target="_blank">Projects</a> •
      <a href="https://wangchujiang.com/#/sponsor" target="_blank">Sponsor</a> •
      <a href="https://wangchujiang.com/#/app" target="_blank">More Apps</a><br><br>Released under the MIT License. Copyright © 2024 <a href="https://wangchujiang.com/#/about" target="_blank">Kenny Wong</a><br>Generated by <a href="https://github.com/jaywcjlove/idoc" target="_blank">idoc</a> v1.29.0
    </div>
    <script src="../js/tocbot.js?v=1.29.0"></script>
  </body>
</html>
